#ifndef _CIRBUF_H_
#define _CIRBUF_H_

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>

typedef struct {
    uint32_t wIdx;
    uint32_t rIdx;
    uint32_t size;
    uint32_t remain;
    uint8_t status;
    char *fifo;
} CirBuf;

extern int32_t CirBufInit(CirBuf *cirbCB, char *fifo, uint32_t size);
extern void CirBufDeinit(CirBuf *cirbCB);
extern int32_t CirBufUsedSize(CirBuf *cirbCB);

extern int32_t CirBufWrite(CirBuf *cirbCB, const char *buf, uint32_t size);
extern int32_t CirBufRead(CirBuf *cirbCB, char *buf, uint32_t size);

#endif
